package com.sample.test;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ***
 * @time 2017-04-19-11:14
 */
public class CrossReference {
    private static int unit = 20 * 1024;

    public static void main(String[] args) {
        allocate();

        try {
            Thread.sleep(1000);
            System.out.println("allocate end************");
            Thread.sleep(100000);
        } catch (Exception e){
            e.printStackTrace();
        }
    }

    private static void allocate(){
        List<BigObject> list = new ArrayList<>();
        int size = 1024 * 1024 * 400;
        int len = size / unit;

        for( int i = 0; i < len; i++){

            BigObject bigObject = new BigObject();
            list.add(bigObject);
        }
    }

    private static class BigObject{
        private byte[] foo;

        BigObject(){
            foo = new byte[unit]; //
        }
    }


}